package net.jiastudy.web.rest.controller;

import io.swagger.annotations.ApiOperation;
import net.jiastudy.biz.enums.AuditStatus;
import net.jiastudy.biz.enums.TaskProgress;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import net.jiastudy.core.base.BaseController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/dicts")
public class DictController extends BaseController {
    @ApiOperation(value = "获取审核状态列表")
    @RequestMapping(path = "/auditStatus", method = RequestMethod.GET)
    public List<Map<String, String>> findAuditStatus() {
        List<Map<String, String>> list = new ArrayList<>();
        for (AuditStatus auditStatus : AuditStatus.values()) {
            Map<String, String> map = new HashMap<String, String>();
            map.put("key", auditStatus.name());
            map.put("value", auditStatus.getDesc());
            list.add(map);
        }
        return list;
    }

    @ApiOperation(value = "获取任务进度列表")
    @RequestMapping(path = "/taskprogress", method = RequestMethod.GET)
    public List<Map<String, String>> findTaskProgress() {
        List<Map<String, String>> list = new ArrayList<>();
        for (TaskProgress taskProgress : TaskProgress.values()) {
            Map<String, String> map = new HashMap<String, String>();
            map.put("key", taskProgress.name());
            map.put("value", taskProgress.getDesc());
            list.add(map);
        }
        return list;
    }
}
